﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using CommunitySystem.PublicOfficialSelectionService;
using System.Collections.ObjectModel;

namespace CommunitySystem
{
    public partial class SetType_ZhaoLuKaoGuanWindow : ChildWindow
    {
        private PublicOfficialSelectionServiceClient Client = new PublicOfficialSelectionServiceClient();
        private KaoGuanModel model = new KaoGuanModel();
        private KaoGuanDetailModel model1 = new KaoGuanDetailModel();
        public int ID;
        private string IDs { get; set; }
        public SetType_ZhaoLuKaoGuanWindow(string ids)
        {
            InitializeComponent();
            //ID = iD;
            IDs = ids;
            this.Title = "考官配置";
            this.DataContext = model1;
            //Client.GetKaoGuanDetailModelCompleted += new EventHandler<GetKaoGuanDetailModelCompletedEventArgs>(Client_GetKaoGuanDetailModelCompleted);
            //Client.GetKaoGuanDetailModelAsync("", jh, ID, "招录工作");
        }

        //void Client_GetKaoGuanDetailModelCompleted(object sender, GetKaoGuanDetailModelCompletedEventArgs e)
        //{
        //    if (e.Result != null&&e.Result.Count>0)
        //        model = e.Result[0];
        //    this.DataContext = model;
        //    //nian.SelectedIndex = DateTime.Today.Year - model.Year;
        //}

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            //model1.ID = ID;
            //model1.Year = model.Year;
            //model1.KaoGuanID = model.KaoGuanID;
            //model1.KGType = model.KGType;
            //model1.XBType = model.XBType;

            //Client.UpdateKaoGuanDetailModelCompleted += new EventHandler<UpdateKaoGuanDetailModelCompletedEventArgs>(Client_UpdateKaoGuanDetailModelCompleted);
            //Client.UpdateKaoGuanDetailModelAsync(model1);
            Client.UpdateKaoGuanDetailModelByidsCompleted += new EventHandler<UpdateKaoGuanDetailModelByidsCompletedEventArgs>(Client_UpdateKaoGuanDetailModelByidsCompleted);

            Client.UpdateKaoGuanDetailModelByidsAsync(IDs, model1.KGType);
        }

        void Client_UpdateKaoGuanDetailModelByidsCompleted(object sender, UpdateKaoGuanDetailModelByidsCompletedEventArgs e)
        {
            if (e.Result == true)
            {
                SilverlightMessageBoxLibrary.Message.InfoMessage("设置成功！");
                this.DialogResult = true;
            }
        }

        //void Client_UpdateKaoGuanDetailModelCompleted(object sender, UpdateKaoGuanDetailModelCompletedEventArgs e)
        //{
        //    if (e.Result == true)
        //    {
        //        SilverlightMessageBoxLibrary.Message.InfoMessage("设置成功！");
        //        this.DialogResult = true;
        //    }
        //}

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}
